// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: jing

#include <cxxopts.hpp>
#include <spdlog/spdlog.h>

#include "appcoin2/feed/fastfeed_util.h"
#include "coin2/strategy/strategy.h"

using coin2::exchange::base::feed::FeedUpdate;
using namespace coin2::app;

class NoOpStrategy : public ::coin2::strategy::IStrategy {
  void onTradeFeed(const FeedUpdate& upd) override {}
  void onBookFeed(const FeedUpdate& upd) override {}
};

int main(int argc, char* argv[]) {
  DriverConfig app;

  cxxopts::Options opt("Feed Checker", "Run the feed checker");
  SetupOptions(&opt);
  opt.add_options()(
      "log-dir",
      "feed checker log directory",
      cxxopts::value<std::string>()->default_value(
          "/remote/iosg/coin/deploy/coin2_feedchecker/logs"));

  auto res = opt.parse(argc, argv);

  ParseOptionsIntoConfig(res, &app);

  // Start feed checker
  spdlog::info("=== Feed Checker start ===");
  LogAppConfig(res, app);
  spdlog::warn("running ..");

  NoOpStrategy nooper;
  Driver driver(app, &nooper);
  driver.Run();

  spdlog::info("=== Feed Checker done ===");

  return 0;
}
